Skip to content

http tap: add request/response trailer matching#5804

Merged
mattklein123 merged 3 commits intomasterfrom
tap_trailers_match
Feb 1, 2019
Merged

http tap: add request/response trailer matching#5804
mattklein123 merged 3 commits intomasterfrom
tap_trailers_match

Conversation

@mattklein123
Copy link
Member

  1. Add request/response trailer matching
  2. Output request/response trailers
  3. Refactor matchers to reduce boilerplate and make it harder
    to make mistakes when adding new update functions.
  4. Split out a match configuration for HTTP request and response
    into individual things like request headers, request trailers,
    etc. This will make it easier and more logical to add various
    types of body matching and wire it up using the existing and/or
    logic.

Risk Level: Low
Testing: New tests
Docs Changes: Complete
Release Notes: N/A

1) Add request/response trailer matching
2) Output request/response trailers
3) Refactor matchers to reduce boilerplate and make it harder
   to make mistakes when adding new update functions.
4) Split out a match configuration for HTTP request and response
   into individual things like request headers, request trailers,
   etc. This will make it easier and more logical to add various
   types of body matching and wire it up using the existing and/or
   logic.

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

@htuch @lizan PTAL.

@htuch I think this should address your matcher code duplication concerns from the previous PR.

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (assuming you have full test coverage with the new test). One API-level minor comment.

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

@htuch updated

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

// HTTP request match configuration.
HttpRequestMatch http_request_match = 5;
// HTTP request headers match configuration.
HttpHeadersMatch http_request_headers_match = 5;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we organize this a bit, just like how BufferedTrace organized? i.e.

message HttpMessageMatch {
  HttpHeadersMatch headers_match;
  HttpTrailersMatch trailers_match;
}

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how I had this originally, but IMO we don't want this, because it makes it much more confusing on how to apply and/or logic.

Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

One thing is probably not actionable in this PR but just want to note:

gRPC HTTP2 protocol maps a response with one HEADERS w/END_STREAM as Trailers-Only response. So it means this matching frame (as well as access logger matchers, which is what #5682 addresses) isn't easy to make it match all grpc-status/grpc-message.

@mattklein123
Copy link
Member Author

gRPC HTTP2 protocol maps a response with one HEADERS w/END_STREAM as Trailers-Only response. So it means this matching frame (as well as access logger matchers, which is what #5682 addresses) isn't easy to make it match all grpc-status/grpc-message.

Yes, agreed. FWIW my plan, once I get the basics implemented, is to actually have more interesting matchers like JSON, gRPC, etc.

@mattklein123 mattklein123 merged commit fbcf6bc into master Feb 1, 2019
@mattklein123 mattklein123 deleted the tap_trailers_match branch February 1, 2019 23:56
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
1) Add request/response trailer matching
2) Output request/response trailers
3) Refactor matchers to reduce boilerplate and make it harder
   to make mistakes when adding new update functions.
4) Split out a match configuration for HTTP request and response
   into individual things like request headers, request trailers,
   etc. This will make it easier and more logical to add various
   types of body matching and wire it up using the existing and/or
   logic.

Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants